# 作者：lian

def open_r():
    """
    读取文件
    :return:
    """

    file = open('file2.txt',mode='r+',encoding='UTF-8')
    text = file.read()
    print(text)
    file.write('world')
    file.close()

def open_w():
    """
    练习w模式
    :return:
    """
    file = open('file3',mode = 'w',encoding='utf-8') #文件不存在就会创建，存在就会清空
    file.write('')

def open_a():
    file = open("file3",mode='r+',encoding='utf-8')
    file.write('how')
    file.close()

def read_line():
    file = open('README')

    while True:
       text = file.readline()
       if not text:
          break

        print(text,end="")


    file.close()

if __name__ == '__main__':
    open_a()